import json
import os,pytest

import requests


@pytest.fixture(scope='session',autouse=True)
def getid():
    data = getsessionid()
    headers={"userId":str(data[1]),"sessionId":data[0]}
    return headers

def getsessionid():
    url = os.getenv('domain_url')+os.getenv('login_url')
    body={'email':'1478997572@qq.com','pwd':'eWLPHopE945d2ivttHaQTQ=='}
    r = requests.post(url,data=body).json()
    print(json.dumps(r,indent=4,ensure_ascii=False))
    return r['result']['sessionId'],r['result']['userId']